package com.zjsd.mobile.controller;

import org.wltea.analyzer.core.IKSegmenter;
import org.wltea.analyzer.core.Lexeme;

import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;

public class TestController {
    public static void main(String[] args) throws Exception {
        String text = "民用电梯";

        List<String> words = new ArrayList<>();
        try (StringReader reader = new StringReader(text)) {
            IKSegmenter ik = new IKSegmenter(reader, true);  // true 开启智能分词
            Lexeme lexeme;
            while ((lexeme = ik.next()) != null) {
                words.add(lexeme.getLexemeText());
            }
        }

        System.out.println(words);
    }
}
